<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
<?php
    if(isset($_POST["table"])) {$table = utf8_decode($_POST["table"]);} else{$table = "";}
    if(isset($_POST["ligne"])) {$ligne = utf8_decode($_POST["ligne"]);} else{$ligne = "";}
    
    require_once '../include/class.pdoSio.inc.php';
    
    if($table == "experience_prof") {
        if(isset($_POST["poste"])) {$poste = addslashes($_POST["poste"]);} else{$poste = "";}
        if(isset($_POST["anneeDebut"])) {$anneeDebut = $_POST["anneeDebut"];} else{$anneeDebut = "";}
        if(isset($_POST["anneeFin"])) {$anneeFin = $_POST["anneeFin"];} else{$anneeFin = "";}
        if(isset($_POST["fonction"])) {$fonction = addslashes($_POST["fonction"]);} else{$fonction = "";}
        $pdo = PdoSio::getPdoSio();
        echo "INSERT INTO cv_experience_prof VALUES (null, ".$ligne.", '".$poste."', ".$anneeDebut.", ".$anneeFin.", '".$fonction."')";
        $etudiants = $pdo->requeteAction("INSERT INTO cv_experience_prof VALUES (null, ".$ligne.", '".$poste."', ".$anneeDebut.", ".$anneeFin.", '".$fonction."')");
    } elseif ($table == "formation") {
        if(isset($_POST["Diplome"])) {$diplome = addslashes($_POST["Diplome"]);} else{$diplome = "";}
        if(isset($_POST["AnneeDebut"])) {$AnneeDebut = $_POST["AnneeDebut"];} else{$AnneeDebut = "";}
        if(isset($_POST["AnneeFin"])) {$AnneeFin = $_POST["AnneeFin"];} else{$AnneeFin = "";}
        if(isset($_POST["Etab"])) {$etab = addslashes(utf8_decode($_POST["Etab"]));} else{$etab = "";}
        $pdo = PdoSio::getPdoSio();
        $etudiants = $pdo->requeteAction("INSERT INTO cv_formation VALUES (null, ".$ligne.", '".$diplome."', ".$AnneeDebut.", ".$AnneeFin.", '".$etab."')");
    } elseif ($table == "informatique") {
        if(isset($_POST["competence"])) {$competence = addslashes($_POST["competence"]);} else{$competence = "";}
        $pdo = PdoSio::getPdoSio();
        $etudiants = $pdo->requeteAction("INSERT INTO cv_informatique VALUES (null, ".$ligne.", '".$competence."')");
    } elseif ($table == "interet") {
        if(isset($_POST["musique"])) {$musique = addslashes($_POST["musique"]);} else{$musique = "";}
        if(isset($_POST["sport"])) {$sport = addslashes($_POST["sport"]);} else{$sport = "";}
        if(isset($_POST["autre"])) {$autre = addslashes($_POST["autre"]);} else{$autre = "";}
        $pdo = PdoSio::getPdoSio();
        $etudiants = $pdo->requeteAction("INSERT INTO cv_interet VALUES (null, ".$ligne.", '".$musique."', '".$sport."', '".$autre."')");
    } elseif ($table == "langue") {
        if(isset($_POST["langue"])) {$langue = addslashes($_POST["langue"]);} else{$langue = "";}
        if(isset($_POST["niveau"])) {$niveau = addslashes($_POST["niveau"]);} else{$niveau = "";}
        $pdo = PdoSio::getPdoSio();
        echo "INSERT INTO cv_langue VALUES (null, ".$ligne.", '".$langue."', '".$niveau."')";
        $etudiants = $pdo->requeteAction("INSERT INTO cv_langue VALUES (null, ".$ligne.", '".$langue."', '".$niveau."')");
    } else {
        if(isset($_POST["photo"])) {$photo = $_POST["photo"];} else{$photo = "";}
        $image = $_FILES['photo']['tmp_name'];
        $image = file_get_contents($image);
        echo $image;
        file_exists($image);
        copy($image, $_FILES['photo']['name']);
        $pdo = PdoSio::getPdoSio();
        $etudiants = $pdo->requeteAction("INSERT INTO cv_photo VALUES (null, ".$ligne.", ".$image.")");
    }
    header("Location: ../index.php?uc=cv&action=visualiser&id=".$ligne."&table=".$table);
?>
</html>
